home *** CD-ROM | disk | FTP | other *** search
/ IRIX 6.5 Applications 2002 November / SGI IRIX 6.5 Applications 2002 November.iso / dev / insight_dev.idb / usr / include / make / commondocrules.z / commondocrules
Encoding:
Text File  |  2002-10-16  |  32.0 KB  |  1,010 lines

  1. # Common rules for making SGML, DocBook XML and HTML 
  2. #
  3. # File organization
  4. # 1. Initialize variables and constants
  5. # 2. Rules for specific file types
  6. # 3. Rules to build a single book SGML file
  7. # 4. Rules to transform SGML into XML
  8. # 5. Rules to transform XML into HTML
  9. # 6. Install and IDB rules
  10. # 7. Clean up rules
  11. # 8. Figure rules
  12. # 9. Misc. rules
  13.  
  14. ##############################################################
  15. #
  16. # Section #1 - Initialization
  17. #
  18. ##############################################################
  19.  
  20. # BOOK_FILES is defined when it's an SGML book...
  21. #if defined(BOOK_FILES)
  22. SOURCES     = ${BOOK_FILES}
  23. TMP_TARGETS = ${BOOK_FILES:.doc=.sgm}
  24. TARGETS     = ${TMP_TARGETS:.fm=.sgm}
  25.  
  26. TMP_XXX_FILES = ${BOOK_FILES:S/.doc$/.sgm/g}
  27. XXX_FILES   = ${TMP_XXX_FILES:S/.fm$/.sgm/g}
  28. SGM_FILES   = ${XXX_FILES:S/.mif$/.sgm/g}
  29. ERR_FILES   = ${SGM_FILES:S/.sgm$/.err/g}
  30. DIRT_FILES  = booklist.txt
  31.  
  32. TMP_MIF_FILES = ${BOOK_FILES:S/.doc$/.mif/g}
  33. MIF_FILES   = ${TMP_MIF_FILES:S/.fm$/.mif/g}
  34. TMP_BACKUP_FILES = ${BOOK_FILES:S/.doc$/.backup.doc/g}
  35. BACKUP_FILES = ${TMP_BACKUP_FILES:S/.fm$/.backup.fm/g}
  36.  
  37. #if ${BOOK_FILES:S/[     ]*/ /g} == "${MIF_FILES}"
  38. MIF_FILES   =
  39. #endif
  40. #endif
  41.  
  42. #if defined(BOOK_FILES) && ${BOOK_FILES} == "book.sgm" && ${DTD} == "SGIDOCBK"
  43. PARSE_SGML  = TRUE
  44. SGM_FILES   != ls book.sgm *.sgml | grep -v ${MASTER_SGM}
  45. MIF_FILES   =
  46. ERR_FILES   =
  47. #endif
  48.  
  49. SHELF       != echo ${BOOKSHELF} | sed "s/.*\///"
  50. LANG_ID     != echo ${BOOK_LANG} | sed "s/_.*//" | tr "[a-z]" "[A-Z]" | sed "s/JA/JP/" | sed "s/C/EN/"
  51. DOCTYPE        = '<!DOCTYPE SGIDOCBK PUBLIC "-//Silicon Graphics, Inc.//DTD DocBook V2.3-based Subset V1.5//${LANG_ID}" [ ]>'
  52.  
  53. LANGUAGE    != echo ${LANG_ID} | tr "[A-Z]" "[a-z]" | sed "s/jp/ja/" 
  54. MKBOOK_FLAGS = -language ${LANGUAGE}
  55.  
  56. FULL_TITLE_ENCODED    != echo ${FULL_TITLE} | sed -e 's/\&/\&/g' -e 's/"/\"/g' -e "s/'/\'/g" -e "s/</\</g" -e "s/>/\>/g" | perl -p -e 's/([\x80-\xFF])/sprintf("&\#x%lx;", ord($$1))/ge'
  57. PARTNUMBER        != echo ${VERSION} | sed -e 's/[, ].*$$//'
  58. DOCBOOK_OVERRIDE    = prod/${PARTNUMBER}.docbook.xml
  59. DEFAULT_PDF        = prod/${PARTNUMBER}.pdf
  60.  
  61. XSLT_PARAMS =
  62.  
  63. #if defined(CHUNK_SECTION_DEPTH)
  64. XSLT_PARAMS = --param chunk.section.depth ${CHUNK_SECTION_DEPTH}
  65. #elif ${SHELF} == "Help"
  66. XSLT_PARAMS = --param chunk.section.depth 1
  67. #endif
  68.  
  69. #if make(review)
  70. REVIEW = -draft
  71. XSLT_PARAMS += --param show.comments 1
  72. #endif
  73.  
  74. #if ${NUMBERED_HEADS} == "Y"
  75. XSLT_PARAMS += --param section.autolabel 1 --param section.label.includes.component.label 1
  76. #endif
  77.  
  78. #if defined(LOCAL_HTML_XSLT)
  79. HTML_XSLT = ../../${LOCAL_HTML_XSLT}
  80. #elif exists(xslt/main-html.xsl)
  81. HTML_XSLT = ../../xslt/main-html.xsl
  82. #else
  83. HTML_XSLT = ../xslt/sgi/sgi-html-chunk.xsl
  84. #endif
  85.  
  86. # all the definitions based on the specific DTD in the Makefile
  87. #if ${DTD} == "SGIDOCBK"
  88. REAL_DTD = ${SGIDOCBK_LIB}/dtd/default.dtd
  89. STYLES_DIR = ${SGIDOCBK_LIB}/styles
  90. HIDDEN ?= FALSE
  91.  
  92. #elif ${DTD} == "SGIDOC"
  93. REAL_DTD = ${SGIDOC_LIB}/dtd/default.dtd
  94. STYLES_DIR = ${SGIDOC_LIB}/styles
  95. HIDDEN ?= FALSE
  96.  
  97. #elif ${DTD} == "XHELP"
  98. REAL_DTD = ${XHELP_LIB}/dtd/XHELP.dtd
  99. STYLES_DIR = ${XHELP_LIB}/styles
  100. HIDDEN ?= TRUE
  101.  
  102. #elif ${DTD} == "DOCBOOK"
  103. REAL_DTD = ${DOCBOOK_LIB}/dtd/docbook.dtd
  104. STYLES_DIR = ${DOCBOOK_LIB}/styles
  105. HIDDEN ?= FALSE
  106.  
  107. #else
  108. REAL_DTD = ../../${BOOK}.dtd
  109. STYLES_DIR = ../../styles
  110. #endif
  111.  
  112. # XXX Problem with multi-byte locales and bob index generation.
  113. # XXX This capability is disabled.
  114. #
  115.  
  116. # Default encoding values
  117. XML_ENCODING = ISO-8859-1
  118. HTML_ENCODING = ISO-8859-1
  119. HTML_CHARSET = ISO-8859-1
  120.  
  121. # Used to redirect to an L10N specific set of entities
  122. SGML2XML_L10N = -public '-//Silicon Graphics, Inc.//XML L10N Entity DTD V1.0//EN' -system 'dtd/entity-dtd/l10n-entity.dtd'
  123.  
  124. #if ${BOOK_LANG} == "C"
  125.  
  126. #elif ${BOOK_LANG} == "de" 
  127.  
  128. #elif ${BOOK_LANG} == "fr" 
  129.  
  130. #elif ${BOOK_LANG} == "es" 
  131.  
  132. #elif ${BOOK_LANG} == "ja_JP.EUC" 
  133. XML_ENCODING = eucJP
  134. HTML_ENCODING = eucJP
  135. HTML_CHARSET = euc-jp
  136. NO_BOB_INDEX = TRUE
  137. NO_SGSEARCH = TRUE
  138. SGML2XML_ARGS = ${SGML2XML_L10N}
  139.  
  140. #elif ${BOOK_LANG} == "ja_JP.SJIS"
  141. XML_ENCODING = sjis
  142. HTML_ENCODING = eucJP 
  143. HTML_CHARSET = euc-jp
  144. NO_BOB_INDEX = TRUE
  145. NO_SGSEARCH = TRUE
  146. SGML2XML_ARGS = ${SGML2XML_L10N}
  147.  
  148. #elif ${BOOK_LANG} == "ko_KR.euc" 
  149. XML_ENCODING = eucKR
  150. HTML_ENCODING = eucKR
  151. HTML_CHARSET = euc-kr
  152. NO_BOB_INDEX = TRUE
  153. NO_SGSEARCH = TRUE
  154. SGML2XML_ARGS = ${SGML2XML_L10N}
  155.  
  156. #elif ${BOOK_LANG} == "zh_CN.ugb" 
  157. XML_ENCODING = gbk
  158. HTML_ENCODING = gbk
  159. HTML_CHARSET = gb2312
  160. NO_BOB_INDEX = TRUE
  161. NO_SGSEARCH = TRUE
  162. SGML2XML_ARGS = ${SGML2XML_L10N}
  163.  
  164. #elif ${BOOK_LANG} == "zh_CN.gbk" 
  165. XML_ENCODING = gbk
  166. HTML_ENCODING = gbk
  167. HTML_CHARSET = gb2312
  168. NO_BOB_INDEX = TRUE
  169. NO_SGSEARCH = TRUE
  170. SGML2XML_ARGS = ${SGML2XML_L10N}
  171.  
  172. #elif ${BOOK_LANG} == "zh_TW.ucns" 
  173. XML_ENCODING = eucTW
  174. HTML_ENCODING = eucTW
  175. HTML_CHARSET = x-euc-tw
  176. NO_BOB_INDEX = TRUE
  177. NO_SGSEARCH = TRUE
  178. SGML2XML_ARGS = ${SGML2XML_L10N}
  179.  
  180. #elif ${BOOK_LANG} == "zh_TW.big5" 
  181. XML_ENCODING = big5
  182. HTML_ENCODING = big5
  183. HTML_CHARSET = big5
  184. NO_BOB_INDEX = TRUE
  185. NO_SGSEARCH = TRUE
  186. SGML2XML_ARGS = ${SGML2XML_L10N}
  187.  
  188. #else
  189. INVALID_LANG = "TRUE"
  190. #endif
  191.  
  192. ##############################################################
  193. #
  194. # Section #2 - File type conversion rules
  195. #
  196. ##############################################################
  197.  
  198. .SUFFIXES: .sgm .doc .fm .mif .err
  199.  
  200. ## Rule for converting Frame files to MIF files
  201. ## if not SGIDOC DTD then don't use the conditional file
  202. .fm.mif .doc.mif:
  203. #if ${DTD} == "SGIDOC" || ${DTD} == "SGIDOCBK"
  204.     @TMPFILE=${TMPDIR}/${@:.mif=.$$.tmp}; \
  205.     TMP_CONDITION_FILE=${TMPDIR}/${@:.mif=.$$.cond.tmp}; \
  206.     echo "system \"cp ${CONDITION_FILE} $${TMP_CONDITION_FILE}\"" > $${TMPFILE}; \
  207.     echo "system \"chmod 664 $${TMP_CONDITION_FILE}\"" >> $${TMPFILE}; \
  208.     echo "Open $<" >> $${TMPFILE}; \
  209.     echo "Open $${TMP_CONDITION_FILE}" >> $${TMPFILE}; \
  210.     echo "UseFormatsFrom x $< $${TMP_CONDITION_FILE}" >> $${TMPFILE}; \
  211.     echo "SaveAs m $< $*.mif" >> $${TMPFILE}; \
  212.     echo "Quit $<" >> $${TMPFILE}; \
  213.     ${FMBATCH} $${TMPFILE}; \
  214.     ${RM} -f $${TMPFILE} $${TMP_CONDITION_FILE}
  215. #else
  216.     @TMPFILE=${TMPDIR}/${@:.mif=.$$.tmp}; \
  217.     echo "Open $<" > $${TMPFILE}; \
  218.     echo "SaveAs m $< $*.mif" >> $${TMPFILE}; \
  219.     echo "Quit $<" >> $${TMPFILE}; \
  220.     ${FMBATCH} $${TMPFILE}; \
  221.     ${RM} -f $${TMPFILE}
  222. #endif
  223.  
  224. # Rule for converting MIF files to SGML files
  225. # this also builds CGM figures if necessary
  226. .mif.sgm:
  227. #if ${DTD} == "SGIDOCBK"
  228.     @${MIF2SGIDOCBK} ${CGM_NOTRAS} $<
  229. #elif ${DTD} == "SGIDOC"
  230. #if defined(BOOK_LANG)
  231.     @${MIF2SGML} ${CGM_NOTRAS} -i ${INTL_MAP_DIR}/${BOOK_LANG}.intl_map $<
  232. #else
  233.     @${MIF2SGML} ${CGM_NOTRAS} $<
  234. #endif
  235. #elif ${DTD} == "XHELP"
  236.     @echo "Frame to XHELP not supported at this time"; exit 1
  237. #elif ${DTD} == "DOCBOOK"
  238.     @echo "Generic Frame to DocBook requires Passage's translator"; exit 1
  239. #else
  240.     ${OTHER_TRANSLATOR} $<
  241. #endif
  242.     -@ mkdir -p online 1> /dev/null 2>&1
  243.     @if (`grep 'RASTERCONVERT' $*.sgm>/dev/null`) then \
  244.       echo "Creating CGM images..."; \
  245.       (CLHOME=${CLHOME}; MIFTOCGM_IP=${MIFTOCGM_IP}; \
  246.         export CLHOME MIFTOCGM_IP; \
  247.         ${MIFTOCGM} ${CGM_VERBOSE} -c ${CLHOME}/data/kt.map -i $< -o online/$*.cgm ); \
  248.       TIFF_FILES=`grep '<!-- RASTERCONVERT:' $*.sgm |sed -e 's/.*<!-- RASTERCONVERT: \(.*\) -->.*/\1/'` ; \
  249.       for i in $${TIFF_FILES} ; do \
  250.             echo "Converting" $$i "to GIF"; \
  251.         N_GIF=`echo $$i|sed 's/\.cgm$$/-1.gif/'|sed 's/\.cgm\([0-9][0-9]*\)/-\1\.gif/'`; \
  252.             (CLHOME=${CLHOME}; export CLHOME; \
  253.             ${CLTRANS} online/$$i online/$$i.out -of tiff \
  254.             ${CGM_VERBOSE} \
  255.             -oo "${CGM_VERBOSE} -t palette -comp lzw -dpi 285"); \
  256.         ( LD_LIBRARY_PATH=${TOOLROOT}/usr/lib32/internal; export LD_LIBRARY_PATH; \
  257.             ${TIFFTOPNM} online/$$i.out | ${PNMSCALE} .37 | ${PNMCROP} | \
  258.         ${PNMMARGIN} -white 10 | \
  259.         ${PPMQUANT} 256 > ${TMPDIR}/$$i.ppm; \
  260.         /usr/sbin/fromppm ${TMPDIR}/$$i.ppm ${TMPDIR}/$$i.rgb; \
  261.         /usr/sbin/hipass3 ${TMPDIR}/$$i.rgb ${TMPDIR}/$$i.rgb_sh .5; \
  262.         ${TOGIF} ${TMPDIR}/$$i.rgb_sh online/$${N_GIF} -u ) ; \
  263.             ${RM} -f online/$$i.out online/$$i ${TMPDIR}/$$i.ppm ${TMPDIR}/$$i.rgb ${TMPDIR}/$$i.rgb_sh; \
  264.       done; \
  265.     fi
  266.  
  267. # Rule for generating UNKNOWN errors report files for SGML files
  268. .sgm.err:
  269.     -@${EGREP} '<\!\-\- ERROR|<\!\-\- WARNING|<UNKNOWN.ERROR' $< > $*.err
  270.  
  271. EndPart:
  272.     @echo "</PART>" > EndPart
  273.  
  274. EndPart.err:
  275.     @touch EndPart.err
  276.  
  277. ##############################################################
  278. #
  279. # Section #3 - Rules to build a single, whole-book SGML file
  280. #
  281. ##############################################################
  282.  
  283. # Build the master SGML file which is concatenation of all individual
  284. # SGML files with TITLE at the front and <SGIDOCBK> tag around
  285. # the <BOOK> and individual chapter content.
  286. #
  287. # OR parse the book.sgm file to generate the master SGML file
  288.  
  289. ${MASTER_SGM}: ${SGM_FILES}
  290. #if defined(INVALID_LANG)
  291.     @echo "WARNING: ${BOOK_LANG} is an unsupported LANG value. Supported values are:"
  292.     @echo " C, de, fr, es, ja_JP.EUC, ja_JP.SJIS, ko_KR.euc, zh_CN.ugb,"
  293.     @echo " zh_CN.gbk, zh_TW.ucns, and zh_TW.big5."
  294. #endif
  295.     @echo " ======== Building master sgml file ======== "
  296.     @${RM} -f ${MASTER_SGM}
  297.     @if [ "${SGM_FILES}" = "" ] ; then \
  298.       echo "error: No SGML files to process"; \
  299.       exit 1; \
  300.     fi 
  301.     @${RM} -f ${TMP_MASTER_SGM}
  302.     @${RM} -f ${INDEXFILE}
  303. #if defined(PARSE_SGML)
  304.     @${RM} -f bobindex.idx
  305.     @${SPAM} -c ${CATALOG} -r -mms -x -x ${BOOK_FILES} > ${TMP_MASTER_SGM}
  306.     @${MAKE_BLDSGML} $(REVIEW) -I${TMP_MASTER_SGM} -O${MASTER_SGM}
  307. #if make(install)
  308.     @${RM} -f ${TMP_MASTER_SGM}
  309.     @${MV} ${MASTER_SGM} ${TMP_MASTER_SGM}
  310.     @${XFORM_SGML} -I${TMP_MASTER_SGM} -O${MASTER_SGM}
  311. #endif
  312.     @${RM} -f ${TMP_MASTER_SGM}
  313. #else
  314. #if ${DTD} == "SGIDOC" || ${DTD} == "SGIDOCBK"
  315. #if ! defined(NO_BOB_INDEX)
  316.     @for i in ${SGM_FILES}; do cat $$i >> ${TMP_MASTER_SGM}; done
  317. #if ${DTD} == "SGIDOC"
  318.     @cat ${TMP_MASTER_SGM} | ${INDEXGEN} -s -o ${INDEXFILE}
  319. #else
  320.     @${INDEXGENDB} -i ${TMP_MASTER_SGM} -s -o ${INDEXFILE}
  321. #endif
  322. #endif
  323. #if ${DTD} == "SGIDOC"
  324.     @if [ "${DOC_TYPE}" = "" ] ; then \
  325.       echo "<SGIDOC LANG=\"${BOOK_LANG}\"><MANUAL>" > ${MASTER_SGM}; \
  326.     else \
  327.       echo "<SGIDOC LANG=\"${BOOK_LANG}\"><${DOC_TYPE}>" > ${MASTER_SGM}; \
  328.     fi 
  329. #else
  330.     @echo ${DOCTYPE} > ${MASTER_SGM}
  331. #if ${NUMBERED_HEADS} == "Y"
  332.     @echo "<SGIDOCBK LANG=\"${BOOK_LANG}\" NUMHEADS=\"Y\"><BOOK>" >> ${MASTER_SGM}
  333. #else
  334.     @echo "<SGIDOCBK LANG=\"${BOOK_LANG}\" NUMHEADS=\"N\"><BOOK>" >> ${MASTER_SGM}
  335. #endif
  336. #endif
  337. #endif
  338. #if ! defined(NO_BOB_INDEX) && ${DTD} == "SGIDOCBK"
  339.     @cat ${TMP_MASTER_SGM} >> ${MASTER_SGM}
  340. #else
  341.     @for i in ${SGM_FILES}; do cat $$i >> ${MASTER_SGM}; done
  342. #endif
  343. #if ${DTD} == "SGIDOC" || ${DTD} == "SGIDOCBK"
  344. #if ! defined(NO_BOB_INDEX)
  345.     @cat ${INDEXFILE} >> ${MASTER_SGM}
  346. #endif
  347. #if ${DTD} == "SGIDOC"
  348.     @if [ "${DOC_TYPE}" = "" ] ; then \
  349.       echo "</MANUAL></SGIDOC>" >> ${MASTER_SGM} ; \
  350.     else \
  351.       echo "</${DOC_TYPE}></SGIDOC>" >> ${MASTER_SGM} ; \
  352.     fi
  353. #else
  354.     @echo "</BOOK></SGIDOCBK>" >> ${MASTER_SGM}
  355. #endif
  356. #if make(install)
  357.     @${RM} -f ${TMP_MASTER_SGM}
  358.     @${MV} ${MASTER_SGM} ${TMP_MASTER_SGM}
  359.     @${XFORM_SGML} -I${TMP_MASTER_SGM} -O${MASTER_SGM}
  360. #endif
  361.     @${RM} -f ${TMP_MASTER_SGM}
  362. #endif
  363. #endif
  364. #if defined(BOOK_FILTER) && exists(${BOOK_FILTER})
  365.     @${BOOK_FILTER} ${MASTER_SGM} > ${MASTER_SGM}.new
  366.     @${MV} ${MASTER_SGM}.new ${MASTER_SGM}
  367. #endif
  368.  
  369. ##############################################################
  370. #
  371. # Section #4 - SGML to DocBook XML conversion rules
  372. #
  373. ##############################################################
  374.  
  375. prep_build: build/.placeholder
  376.  
  377. build/.placeholder: Makefile
  378.     @echo "=============================================="
  379.     @echo "Setting up the build directory"
  380.     @echo "=============================================="
  381.     @mkdir -p build/sgi_html
  382.     @rm -f build/dtd build/ent
  383.     @ln -s ${XML_DTD} build
  384.     @if [ -d ent.xml ] ; then \
  385.         ln -s ent.xml build/ent ; \
  386.     else \
  387.         ln -s ${XML_ENTS} build/ent ; \
  388.     fi
  389.     @rm -rf build/xslt
  390.     @mkdir -p build/xslt
  391.     @ln -s ${XSLT_STYLES}/docbook-xsl build/xslt/docbook-xsl
  392.     @ln -s ${XSLT_STYLES}/sgi build/xslt/sgi
  393.     @ln -s ${XSLT_STYLES}/conversion build/xslt/conversion
  394.     @touch build/.placeholder
  395.  
  396.  
  397. ${MASTER_XML}: ${MASTER_SGM}
  398.     @echo "=============================================="
  399.     @echo "Transforming SGML to XML"
  400.     @echo "=============================================="
  401.     @mkdir -p build
  402.     @${SGML2XML} $(SGML2XML_ARGS) -nocomments -doctype ${DTD} \
  403.         -encoding ${XML_ENCODING} ${MASTER_SGM} ${MASTER_XML}
  404.  
  405. docbook.xml: build/docbook.xml
  406.  
  407. #if exists(${DOCBOOK_OVERRIDE})
  408. build/docbook.xml: ${DOCBOOK_OVERRIDE} build/.placeholder
  409. ## check if the link exists since make will always recreate it
  410.     @echo "================================================================="
  411.     @echo "Copying the existing ${DOCBOOK_OVERRIDE} XML file"
  412.     @echo "================================================================="
  413.     rm -f build/docbook.xml
  414.     cp ${DOCBOOK_OVERRIDE} build/docbook.xml
  415. #elif ${DTD} == "DOCBOOK_XML"
  416. build/docbook.xml: ${BOOK_FILES} build/.placeholder
  417. ## TODO: adjust dependencies and clean rules for DocBook XML books
  418.     @echo "=============================================="
  419.     @echo "Parsing the ${BOOK_FILES} DocBook XML file"
  420.     @echo "=============================================="
  421.     @${RM} -f build/docbook.xml dtd
  422.     @ln -s ${XML_DTD} dtd 
  423.     @( LD_LIBRARY_PATH=${XMLLIBS}; export LD_LIBRARY_PATH; \
  424.         ${XMLLINT} --timing --valid --noent -o build/docbook.xml ${BOOK_FILES} 2>&1 | tee build/xmllint.log )
  425.     @${RM} -f build/xmllint.errs
  426.     -@grep -i 'error' build/xmllint.log > build/xmllint.errs
  427.     @if [ -s build/xmllint.errs ] ; then \
  428.         echo " " ; \
  429.         echo "DocBook DTD Validity Errors" ; \
  430.         echo "The errors shown above must be corrected." ; \
  431.         echo " " ; \
  432.         ${RM} -f build/docbook.xml ; \
  433.         exit 1 ; \
  434.     fi
  435.     @perl -pi -e 's/fileref\s*=\s*"online\//fileref="figures\//g' build/docbook.xml
  436. #else
  437. build/docbook.xml: ${MASTER_SGM} build/.placeholder
  438.     @echo "=============================================="
  439.     @echo "Transforming SGML to XML"
  440.     @echo "=============================================="
  441.     @${RM} -f build/docbook.xml
  442.     @${SGML2XML} $(SGML2XML_ARGS) -nocomments -doctype ${DTD} \
  443.         -encoding ${XML_ENCODING} ${MASTER_SGM} ${MASTER_XML}
  444.     @echo "=============================================="
  445.     @echo "Transforming ${DTD} XML to DocBook XML"
  446.     @echo "=============================================="
  447. #if ${DTD} == "SGIDOCBK"
  448.     @( LD_LIBRARY_PATH=${XMLLIBS}; export LD_LIBRARY_PATH; ${XSLTPROC} --timing --param makefile.title "'${FULL_TITLE_ENCODED}'" -o ${DOCBOOK_XML} build/xslt/conversion/sgidocbk2docbook.xsl ${MASTER_XML} )
  449. #elif ${DTD} == "SGIDOC"
  450.     @( LD_LIBRARY_PATH=${XMLLIBS}; export LD_LIBRARY_PATH; ${XSLTPROC} --timing --param makefile.title "'${FULL_TITLE_ENCODED}'" -o ${DOCBOOK_XML} build/xslt/conversion/sgidoc2docbook.xsl ${MASTER_XML} )
  451. #elif ${DTD} == "DOCBOOK"
  452.     @${CP} ${MASTER_XML} ${DOCBOOK_XML}
  453. #elif ${DTD} == "CRAYDOCBK"
  454.     @( LD_LIBRARY_PATH=${XMLLIBS}; export LD_LIBRARY_PATH; ${XSLTPROC} --timing -o ${DOCBOOK_XML} build/xslt/conversion/craydocbk2docbook.xsl ${MASTER_XML} )
  455. #else
  456.     @echo " "
  457.     @echo "The ${DTD} DTD is unsupported for automatic XML conversion."
  458.     @echo "You can convert the ${MASTER_SGM} file to DocBook XML"
  459.     @echo "and save the new file as 'prod/docbook.xml' where it"
  460.     @echo "will be used automatically."
  461.     @echo " "
  462.     @exit 1
  463. #endif
  464. ##    @${RM} -f ${MASTER_XML}
  465. #endif
  466.  
  467. ##############################################################
  468. #
  469. # Section #5 - XML to HTML conversion rules
  470. #
  471. ##############################################################
  472.  
  473. .ORDER: docbook.html sgi_data/index.wrd.gz xmlbook_install
  474.  
  475. docbook.html: build/sgi_html/index.html
  476.  
  477. build/sgi_html/index.html: build/docbook.xml
  478.     @echo "=============================================="
  479.     @echo "Transforming DocBook XML to HTML"
  480.     @echo "=============================================="
  481.     @mkdir -p build/sgi_html
  482.     @${RM} -f build/sgi_html/*.html build/sgi_html/*.xml
  483.     @( cd build/sgi_html; LD_LIBRARY_PATH=${XMLLIBS}; export LD_LIBRARY_PATH; \
  484.         ${XSLTPROC} --timing ${XSLT_PARAMS} \
  485.          --param default.encoding "'${HTML_ENCODING}'" \
  486.          -o junk.html ${HTML_XSLT} ../docbook.xml 2>&1 | \
  487.         tee ../xsltproc.log )
  488.     @if [ -a build/sgi_html/junk.html ] ; then \
  489.         echo " " ; \
  490.         echo "FATAL ERROR:" ; \
  491.         echo "The XSLT stylesheets incorrectly produced extra HTML" ; \
  492.         echo "output in the build/sgi_html/junk.html file.  The cause" ; \
  493.         echo "of the problem needs to be investigated." ; \
  494.         echo " " ; \
  495.         exit 1 ; \
  496.     fi
  497.     @if [ ! -f build/sgi_html/index.html ] ; then \
  498.         echo " " ; \
  499.         echo "The HTML generation phase was not successful" ; \
  500.         echo "since an index.html was not created." ; \
  501.         echo " " ; \
  502.         exit 1 ; \
  503.     fi
  504.     @if [ -f build/sgi_html/index.html -a "${HTML_ENCODING}" != "${HTML_CHARSET}" ] ; then \
  505.         echo "=========================================================" ; \
  506.         echo "Switching HTML charset from ${HTML_ENCODING} to ${HTML_CHARSET}" ; \
  507.         echo "=========================================================" ; \
  508.         perl -pi -e 's/(<meta.*?charset=)${HTML_ENCODING}/\1${HTML_CHARSET}/i' build/sgi_html/*.html ; \
  509.     fi
  510.     @if [ -f build/sgi_html/toc.xml ] ; then \
  511.         echo "==============================================" ; \
  512.         echo "Post-processing XML TOC file" ; \
  513.         echo "==============================================" ; \
  514.         mkdir -p build/sgi_data ; \
  515.         rm -f build/sgi_data/toc.xml ; \
  516.         mv build/sgi_html/toc.xml build/sgi_data ; \
  517.         ( LD_LIBRARY_PATH=${XMLLIBS}; export LD_LIBRARY_PATH; \
  518.             ${XSLTPROC} -o build/sgi_data/${BOOK}.toc \
  519.             build/xslt/sgi/sgi-tpl-toc.xsl build/sgi_data/toc.xml ) ; \
  520.     fi
  521.     @echo " "
  522.     @echo "For review:"
  523.     @echo "file://`pwd`/build/sgi_html/index.html"
  524.     @echo " "
  525.  
  526. #if ${DTD} != "HTML"
  527. html_files: build/sgi_html/index.html
  528. #else
  529. html_files: htmlbook
  530. #endif
  531.  
  532. build/redirect.html metadata: booklist.txt _force
  533.     @echo "=============================================="
  534.     @echo "Creating fulltext index, OMF and redirect file"
  535.     @echo "=============================================="
  536.     @mkdir -p build/sgi_data
  537. # Generate the fulltext index
  538. #if ! defined(NO_SGSEARCH)
  539.     @if [ -d build/sgi_html ] ; then \
  540.         ( cd build ; ln -s ../booklist.txt . ; ${DTL2SGFT} -f -l -b ${BOOK} -s . ; rm -f booklist.txt ) ; \
  541.     fi
  542. #endif
  543. # Generate a new OMF metadata file
  544.     @${RM} -f build/*.omf
  545.     @${SGI2OMF} -pth . ${BOOK} > /dev/null
  546.     @${MV} ${BOOK}*.omf build/sgi_data
  547. # Create a redirection HTML file for use by InSight
  548.     @${RM} -f build/redirect.html
  549.     @echo '<html>' > build/redirect.html
  550.     @echo '<head><title>${BOOK} Redirection</title>' >> build/redirect.html
  551.     @if [ -f build/sgi_html/index.html ] ; then \
  552.         echo '<META HTTP-EQUIV=REFRESH CONTENT="0; URL=sgi_html/index.html">' >> build/redirect.html ; \
  553.     elif [ -d build/sgi_html ] ; then \
  554.         echo '<META HTTP-EQUIV=REFRESH CONTENT="0; URL=sgi_html/">' >> build/redirect.html ; \
  555.     elif [ -d build/pdf ] ; then \
  556.         echo '<META HTTP-EQUIV=REFRESH CONTENT="0; URL=pdf/">' >> build/redirect.html ; \
  557.     fi ;
  558.     @echo '</head>' >> build/redirect.html
  559.     @echo '<body bgcolor="#FFFFFF">' >> build/redirect.html
  560.     @if [ -f build/sgi_html/index.html ] ; then \
  561.         echo '<a href="sgi_html/index.html">Redirection Link</a>' >> build/redirect.html ; \
  562.     elif [ -d build/sgi_html ] ; then \
  563.         echo '<a href="sgi_html/">Redirection Link</a>' >> build/redirect.html ; \
  564.     elif [ -d build/pdf ] ; then \
  565.         echo '<a href="pdf/">Redirection Link</a>' >> build/redirect.html ; \
  566.     else \
  567.         echo '<p>This book has no content.</p>' >> build/redirect.html ; \
  568.     fi ;
  569.     @echo '</body></html>' >> build/redirect.html
  570.  
  571. booklist.txt: Makefile
  572.     @echo "=============================================="
  573.     @echo "Creating booklist.txt file"
  574.     @echo "=============================================="
  575. #if ${DTD} != "OTHER"
  576.     @if [ -f booklist.txt ] ; then \
  577.         ${MV} booklist.txt booklist.txt.old; \
  578.     fi
  579.     @echo '<BOOK NAME="${TITLE}" ALIAS="'${FULL_TITLE}'" SGITYPE="sgi_html" SGIVERSION="${VERSION}" SGIBKADDR="${FEEDBACK_ADDR}" SGIGROUP="HTML">' > booklist.txt
  580. #endif
  581.  
  582. ##############################################################
  583. #
  584. # Section #6 - Install and Packaging rules
  585. #
  586. ##############################################################
  587.  
  588. # dummy rule to force a target to be built
  589. _force:
  590.  
  591. #if ${DTD} == "PDF"
  592. default book: booklist.txt copy_pdf build/redirect.html
  593.  
  594. #if defined(RAWIDB)
  595. ## Need to copy_pdf before redirect.html in order to get the redirect right
  596. .ORDER: booklist.txt copy_pdf build/redirect.html common_install
  597. install:: booklist.txt copy_pdf build/redirect.html common_install
  598. #else
  599. install::
  600.     @echo "warning: 'install' not supported if RAWIDB not defined"
  601. #endif
  602.  
  603. # Branch rule for making a book out of 'compiled' sgm files, or HTML
  604. #elif ${DTD} != "HTML"
  605.  
  606. ## We are building a standard SGML/XML book
  607. .ORDER: ${MASTER_SGM} _online build/.placeholder booklist.txt build/docbook.xml build/sgi_html/index.html copy_figures build/redirect.html copy_pdf
  608. default book review help xhelp: booklist.txt build/sgi_html/index.html figures build/redirect.html copy_pdf
  609.  
  610. #if defined(RAWIDB)
  611. .ORDER: ${MASTER_SGM} build/.placeholder booklist.txt build/sgi_html/index.html copy_figures build/redirect.html copy_pdf common_install xmlbook_install
  612. install:: booklist.txt build/sgi_html/index.html copy_figures build/redirect.html xmlbook_install
  613. #else
  614. install::
  615.     @echo "warning: 'install' not supported if RAWIDB not defined"
  616. #endif
  617.  
  618. #else
  619.  
  620. ## We are building a plain HTML book
  621. .ORDER: booklist.txt htmlbook build/redirect.html copy_pdf
  622. default book: htmlbook build/redirect.html copy_pdf
  623.  
  624. review help xhelp:
  625.     @echo "operation not supported with HTML books"
  626.  
  627. clobber clean:
  628.     ${RM} -rf build booklist.txt
  629.  
  630. #if defined(RAWIDB)
  631. .ORDER: booklist.txt htmlbook build/redirect.html copy_pdf common_install htmlbook_install
  632. install: booklist.txt htmlbook build/redirect.html htmlbook_install
  633. #else
  634. install:
  635.     @echo "warning: 'install' not supported if RAWIDB not defined"
  636.  
  637. #endif
  638. #endif
  639.  
  640. copy_pdf: _force
  641. #if defined(PACKAGE_PDF) && ${PACKAGE_PDF} == 1
  642. #if defined(PDF_FILES) && ${PDF_FILES} != ""
  643.     @echo "=============================================="
  644.     @echo "Copying the list of PDF_FILES"
  645.     @echo "=============================================="
  646.     @rm -rf build/pdf
  647.     @mkdir -p build/pdf
  648.     @for i in "$(PDF_FILES)"; do \
  649.         if [ ! -e $$i ] ; then \
  650.             echo "Couldn't find PDF_FILES '$$i'" ; \
  651.             exit 1 ; \
  652.         fi ; \
  653.         cp $$i build/pdf
  654.      done
  655. #elif exists(${DEFAULT_PDF})
  656.     @echo "=============================================="
  657.     @echo "Copying ${DEFAULT_PDF}"
  658.     @echo "=============================================="
  659.     @rm -rf build/pdf
  660.     @mkdir -p build/pdf
  661.     @cp ${DEFAULT_PDF} build/pdf/${BOOK}.pdf
  662. #endif
  663. #endif
  664.  
  665. book.err ${BOOK}.err: ${ERR_FILES}
  666.     @${RM} -f ${BOOK}.err
  667.     @for i in ${ERR_FILES}; do \
  668.       echo "=== $$i Translation Error/Warning report ===" >> ${BOOK}.err; \
  669.       cat $$i >> ${BOOK}.err; \
  670.       echo "" >> ${BOOK}.err; \
  671.     done
  672.  
  673. book.full review.full ${BOOK}.full: ${ERR_FILES} ${MASTER_SGM} book
  674.     @echo "======================================================="
  675.     @echo "Building master report file - ${BOOK}.full"
  676.     @echo "======================================================="
  677.     @${RM} -f ${BOOK}.full
  678.     @for i in ${SGM_FILES}; do \
  679.       base=`basename $$i .sgm`; \
  680.       if [ -f $$base.err ] ; then \
  681.           echo "=== $$base.err Translation Error/Warning report ===" >> ${BOOK}.full; \
  682.           cat $$base.err >> ${BOOK}.full; \
  683.       fi; \
  684.       echo "" >> ${BOOK}.full; \
  685.     done
  686.     @echo "=== ${BOOK} Link QA report file ===" >> ${BOOK}.full
  687.     -@(TOOLROOT=${ITOOLROOT}; export TOOLROOT; \
  688.       ${XREF} ${MASTER_SGM} >> ${BOOK}.full)
  689.     @echo "" >> ${BOOK}.full
  690.  
  691. common_install: copy_pdf
  692.     $(INSTALL) -u root -g sys  -m 755 \
  693.         -idb '${BOOKSUBSYSTEM} removeop("if [ -r $$rbase/usr/sbin/insightAdmin ]; then chroot \$$rbase /usr/sbin/insightAdmin -avfn ${BOOK_LANG} ${BOOKSHELF}>>\$$rbase/var/share/Insight/install.insight.log 2>&1; fi")' \
  694.         -dir ${BOOKSHELF}/${BOOKDIR}
  695. # booklist.txt and redirect index.html idb
  696.     $(INSTALL) -m 644 -f ${BOOKSHELF}/${BOOKDIR} \
  697.         -idb '${BOOKSUBSYSTEM} exitop("(chroot \$$rbase /usr/sbin/insightAdmin -avfn ${BOOK_LANG} ${BOOKSHELF}>>\$$rbase/var/share/Insight/install.insight.log)2>>\$$rbase/var/share/Insight/install.insight.log")' \
  698.         booklist.txt
  699.     $(INSTALL) -m 644 -f ${BOOKSHELF}/${BOOKDIR} -idb ${BOOKSUBSYSTEM} \
  700.         -src build/redirect.html index.html
  701. # sgi_data directory
  702.     $(INSTALL) -u root -g sys  -m 755 -idb ${BOOKSUBSYSTEM} \
  703.         -dir ${BOOKSHELF}/${BOOKDIR}/sgi_data
  704.     for i in build/sgi_data/*; do \
  705.         $(INSTALL) -m 644 -f ${BOOKSHELF}/${BOOKDIR}/sgi_data \
  706.         -idb ${BOOKSUBSYSTEM} \
  707.         -src $$i `basename $$i`; done
  708. ## Idea to move sgi_html install to the common area
  709. ##    for i in `cd build ; find sgi_html -type d -print`; do \
  710. ##        $(INSTALL) -u root -g sys  -m 755 -idb ${BOOKSUBSYSTEM} \
  711. ##        -dir ${BOOKSHELF}/${BOOKDIR}/$$i ; \
  712. ##    done
  713. ##    for i in `cd build/sgi_html ; find * -type f -print`; do \
  714. ##        $(INSTALL) -m 644 -f ${BOOKSHELF}/${BOOKDIR}/sgi_html \
  715. ##        -idb ${BOOKSUBSYSTEM} -src build/sgi_html/$$i $$i ; \
  716. ##    done
  717.     if [ -d build/pdf ] ; then \
  718.         $(INSTALL) -u root -g sys  -m 755 -idb ${BOOKSUBSYSTEM} \
  719.             -dir ${BOOKSHELF}/${BOOKDIR}/pdf ; \
  720.         for i in build/pdf/*.pdf; do \
  721.             $(INSTALL) -m 644 -f ${BOOKSHELF}/${BOOKDIR}/pdf \
  722.                 -idb ${BOOKSUBSYSTEM} \
  723.                 -src $$i `basename $$i` ; \
  724.         done ; \
  725.     fi
  726.  
  727. xmlbook_install: common_install
  728. # sgi_html directory
  729.     $(INSTALL) -u root -g sys  -m 755 -idb ${BOOKSUBSYSTEM} \
  730.         -dir ${BOOKSHELF}/${BOOKDIR}/sgi_html
  731.     for i in build/sgi_html/*.html; do \
  732.         $(INSTALL) -m 644 -f ${BOOKSHELF}/${BOOKDIR}/sgi_html \
  733.         -idb ${BOOKSUBSYSTEM} \
  734.         -src $$i `basename $$i`; done
  735. # sgi_html/figures directory
  736.     if [ -d build/sgi_html/figures ] ; then \
  737.         $(INSTALL) -u root -g sys  -m 755 -idb ${BOOKSUBSYSTEM} \
  738.             -dir ${BOOKSHELF}/${BOOKDIR}/sgi_html/figures ; \
  739.         for i in build/sgi_html/figures/*; do \
  740.             $(INSTALL) -m 644 -f ${BOOKSHELF}/${BOOKDIR}/sgi_html/figures \
  741.             -idb ${BOOKSUBSYSTEM} \
  742.             -src $$i `basename $$i` ; done ; \
  743.     fi
  744. #       Generate helpmap idbs 
  745.     if [ -d help ] ; then \
  746.         if [ "${BOOK_LANG}" = "C" ] ; then \
  747.              $(INSTALL) -m 644 -f ${HELPDIR} -idb ${HELPSUBSYSTEM} \
  748.             `${COPY_HELPMAPS} ${MASTER_SGM} help` ; \
  749.         else \
  750.              for i in `${COPY_HELPMAPS} ${MASTER_SGM} help`; do \
  751.             $(INSTALL) -m 644 -f ${HELPDIR}/help/${BOOK_LANG} \
  752.             -idb ${HELPSUBSYSTEM} \
  753.             -src $$i `basename $$i` ; done ; \
  754.         fi \
  755.     ; fi
  756.  
  757. htmlbook: Makefile booklist.txt _force
  758.     @echo "=============================================="
  759.     @echo "Copying HTML files to build/sgi_html"
  760.     @echo "=============================================="
  761.     @${RM} -rf build/sgi_html
  762.     @mkdir -p build/sgi_html build/sgi_data
  763.     @for d in $(BOOK_DIRS); do \
  764.         mkdir -p build/sgi_html/$$d ; \
  765.         for ext in ${HTML_EXTS}; do \
  766.             for f in $$d/*.$$ext; do \
  767.                 if [ -f $$f ]; then \
  768.                     ${CP} $$f build/sgi_html/$$d; \
  769.                 fi; \
  770.             done; \
  771.         done; \
  772.     done
  773.     @echo " "
  774.     @echo "For review:"
  775.     @if [ -f build/sgi_html/index.html ] ; then \
  776.         echo "file://`pwd`/build/sgi_html/index.html" ; \
  777.     else \
  778.         echo "file://`pwd`/build/sgi_html/" ; \
  779.     fi
  780.     @echo " "
  781.  
  782. htmlbook_install: common_install
  783. #    Generate the sgi_html directory
  784.     $(INSTALL) -u root -g sys  -m 755 -idb ${BOOKSUBSYSTEM} \
  785.         -dir ${BOOKSHELF}/${BOOKDIR}/sgi_html
  786. #       Generate subdirectory idbs, if any
  787.     for d in $(BOOK_DIRS); do \
  788.         if [ "$$d" != "." ]; then \
  789.         $(INSTALL) -m 755 -idb $(BOOKSUBSYSTEM) \
  790.             -dir ${BOOKSHELF}/${BOOKDIR}/sgi_html/$$d; \
  791.         fi; \
  792.     done
  793. #       Generate files idbs 
  794.     for d in $(BOOK_DIRS); do \
  795.         if [ "$$d" = "." ]; then \
  796.         for ext in ${HTML_EXTS}; do \
  797.             for f in build/sgi_html/*.$$ext; do \
  798.             if [ -e $$f ]; then \
  799.                 $(INSTALL) -m 644 -f ${BOOKSHELF}/${BOOKDIR}/sgi_html \
  800.                 -idb ${BOOKSUBSYSTEM} \
  801.                 -src $$f `basename $$f`; \
  802.             fi ; \
  803.             done; \
  804.         done; \
  805.         else \
  806.         for ext in ${HTML_EXTS}; do \
  807.             for f in build/sgi_html/$$d/*.$$ext; do \
  808.             if [ -e $$f ]; then \
  809.                 $(INSTALL) -m 644 -f ${BOOKSHELF}/${BOOKDIR}/sgi_html/$$d \
  810.                 -idb ${BOOKSUBSYSTEM} \
  811.                 -src $$f `basename $$f`; \
  812.             fi ; \
  813.             done; \
  814.         done; \
  815.         fi; \
  816.     done
  817. #       Generate helpmap idbs 
  818.     if [ -d help ] ; then \
  819.         (cd help; \
  820.         if [ "${BOOK_LANG}" = "C" ] ; then \
  821.             $(INSTALL) -m 644 -idb $(HELPSUBSYSTEM) \
  822.              -f ${HELPDIR}/help *.helpmap; \
  823.         else \
  824.         $(INSTALL) -m 644 -idb $(HELPSUBSYSTEM) \
  825.             -f ${HELPDIR}/help/${BOOK_LANG} *.helpmap; \
  826.         fi; \
  827.         cd ..); \
  828.     fi
  829.  
  830. ##############################################################
  831. #
  832. # Section #7 - Clean up rules
  833. #
  834. ##############################################################
  835.  
  836. #if ${DTD} != "HTML"
  837. #if exists($(ROOT)/usr/include/make/commonindexdefs) 
  838. .ORDER: clean_book clean_reports clean_backups sg_index_clean
  839. clean:: clean_book clean_reports clean_backups sg_index_clean
  840. #else
  841. .ORDER: clean_book clean_reports clean_backups
  842. clean:: clean_book clean_reports clean_backups
  843. #endif
  844.     ${RM} -rf $(DIRT) ${LOCALFIGRULES}
  845.  
  846. .ORDER: clean clean_online clean_sgm clean_print
  847. clobber:: clean clean_online clean_sgm clean_print
  848. #endif
  849.  
  850. # Remove the master sgml file and files in the 'books' sub directory.
  851. # Also now remove tmp_gen with generated html files
  852. clean_book::
  853.     ${RM} -f ${MASTER_SGM} ${INDEXFILE} ${MIF_FILES}
  854.     ${RM} -rf build
  855.  
  856. # Remove the report files
  857. #if defined(BOOK_FILES) && ${BOOK_FILES} == "book.sgm"
  858. clean_reports::
  859.     ${RM} -f ${BOOK}.full
  860. #else
  861. clean_reports::
  862.     ${RM} -f ${ERR_FILES} ${BOOK}.err ${BOOK}.full
  863. #endif
  864.  
  865.  
  866. # Remove the generated figures
  867. #if ${AUTO_FIGURES} == 1
  868. clean_online::
  869.     ${UPDATE_FIGURES} -v clobber
  870.  
  871. clean_print::
  872.  
  873. #else
  874.  
  875. clean_online::
  876.     ${RM} -f online/*
  877.  
  878. clean_print::
  879.     ${RM} -f print/*
  880. #endif
  881.  
  882. #if defined(BOOK_FILES)
  883. # Remove all sgml files - only if NONE of the sources are .sgm files
  884. #if ${BOOK_FILES:S/[     ]*/ /g} == "${BOOK_FILES:S/.sgm$/.skip/g}"
  885. clean_sgm::
  886.     ${RM} -f ${SGM_FILES}
  887. #else
  888. clean_sgm::
  889.  
  890. #endif
  891. #endif
  892.  
  893. # Remove Frame backup files
  894. #if defined(BOOK_FILES) && ${BOOK_FILES} == "book.sgm"
  895. clean_backups::
  896. #else
  897. clean_backups::
  898.     ${RM} -f ${BACKUP_FILES}
  899. #endif
  900.  
  901. #if exists($(ROOT)/usr/include/make/commonindexdefs) 
  902. $(INDEXPREF)sg_index_clean:: 
  903.     -@/usr/bin/rm -f $(IDIRT)
  904. #if defined(SRC)
  905.     -@/usr/bin/rm -f $(WORDDIR)/$(IDIRT)
  906. #endif
  907. #endif
  908.  
  909. # Remove any crufty files
  910. XDIRT = printFiles.* onlineFiles.* localFigs.* ${DIRT_FILES} ${BOOK}.sgml.tmp \
  911.     *.bak *.backup booklist.txt.old EndPart.err EndPart
  912.  
  913. ##############################################################
  914. #
  915. # Section #8 - Figure rules
  916. #
  917. ##############################################################
  918.  
  919. ##.ORDER: _online copy_figures
  920. figures: _online copy_figures
  921.  
  922. #if ${AUTO_FIGURES} == 1
  923. localfigrules:
  924. #else
  925. localfigrules: Makefile
  926.     @smake -J 1 -r -f Makefile XXX=$$$$ rules
  927. #endif
  928.  
  929. #if ${AUTO_FIGURES} == 1
  930. _online:
  931. #if make(_online)
  932. ## Run verbosely if _online is the direct target
  933.     @${UPDATE_FIGURES} -v
  934. #else
  935.     @${UPDATE_FIGURES}
  936. #endif
  937. #else
  938. _online: localfigrules
  939.     @if [ -d orig ] ; then \
  940.       (mkdir -p online 1> /dev/null 2>&1; \
  941.       TOOLROOT=${ITOOLROOT}; export TOOLROOT; \
  942.       make -r -f Makefile COMMONPREPRULES=${COMMONFIGRULES} online_figs) ;\
  943.     fi
  944. #endif
  945.  
  946. #if ${AUTO_FIGURES} == 1
  947. _print print:
  948.     @${UPDATE_FIGURES} -v
  949. #else
  950. _print print: localfigrules
  951.     -@mkdir -p print 1> /dev/null 2>&1
  952.     @make -r -f Makefile COMMONPREPRULES=${COMMONFIGRULES} print_figs
  953. #endif
  954.  
  955. copy_figures: build/sgi_html/index.html build/.placeholder _force
  956.     @echo "=============================================="
  957.     @echo "Copying figures into the html directory"
  958.     @echo "=============================================="
  959.     @mkdir -p build/sgi_html/figures
  960.     -@if [ -d online ] ; then \
  961.       (for i in build/sgi_html/figures/*; do \
  962.         ${RM} -f $$i ; done ) ; \
  963.     fi
  964. #if ${DTD} == "SGIDOCBK" || ${DTD} == "SGIDOC"
  965.     @if [ -d online -a -e ${MASTER_SGM} ] ; then \
  966.         ${CLEAN_CGMS} ${MASTER_SGM} online ; \
  967.     fi
  968. #endif
  969.     @${COPY_DOCBOOK_FIGS} build/sgi_html/*.html
  970. #if defined(MISC_FILES)
  971. #if ! empty(MISC_FILES)
  972.     @for i in ${MISC_FILES} ; do \
  973.         if [ -e orig/$$i ] ; then \
  974.             cp orig/$$i build/sgi_html/figures ; \
  975.         elif [ -e online/$$i ] ; then \
  976.             cp online/$$i build/sgi_html/figures ; \
  977.         else \
  978.             echo "Couldn't locate MISC_FILES '$$i'" ; \
  979.             exit 1; \
  980.         fi ; \
  981.     done ;
  982. ##    @(cd orig; ${CP} ${MISC_FILES} ../build/sgi_html/figures ; cd ..)
  983. #endif
  984. #endif
  985.     @( cd build/sgi_html ; ${HTML_IMG_SIZE} *.html )
  986. ## Silently and correctly fails if any files are in the figure directory
  987.     -@rmdir build/sgi_html/figures 1> /dev/null 2>&1
  988.  
  989. ##############################################################
  990. #
  991. # Section #9 - Misc. rules
  992. #
  993. ##############################################################
  994.  
  995. update_frontmatter:
  996.     @if [ -d ${FRONT_DIR} ] ; then \
  997.         echo "Updating the frontmatter directory" ; \
  998.         mkdir -p frontmatter ; \
  999.         cp ${FRONT_DIR}/*.sgml frontmatter ; \
  1000.     else \
  1001.         echo "WARNING: The directory ${FRONT_DIR}" ; \
  1002.         echo "is not accessable therefore we can not update the frontmatter." ; \
  1003.     fi    
  1004.  
  1005. html.tar: book
  1006.     rm -rf build/html html.tar
  1007.     mv build/sgi_html build/html
  1008.     (cd build ; tar -cvf ../html.tar html)
  1009.     mv build/html build/sgi_html
  1010.